#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <boost/thread.hpp>
#include "ICANCmd.h"
#include "J1939.h"
#include "J1939_Config.h"
#include "DTM437.h"

int main(int argc, char **argv)
{
    DTM437 rfid_sensor;
    uint8_t tag_buf[100] = {0};
    TP_RX_MESSAGE tag_data = {
        .data = tag_buf,
        .data_num = 100,
        .SA = 0xEB,
        .byte_count = 0U,
        .PGN = 0xEF00
    };
    uint8_t RFID_DATA[8] = {0xAA, 0x22, 0x33, 0x44, 0x55, 0x66, 0xDD};

    rfid_sensor.init();

    rfid_sensor.async_get_status();
    // rfid_sensor.async_set_rfid_data(0x04, RFID_DATA, 8);
    sleep(2);
    std::cout << "Sleep 2 seconds" << std::endl;

    /* Read Data Size <= 4 no need of TP_RX, use normal Read */
    rfid_sensor.async_get_rfid_data(0x00, 8);
    
    /**
     * @brief when use TP_RX to read more than 4 bytes of data
        while(!J1939_TP_RX_Ready())
        {;}
        J1939_TP_RX_Message(&tag_data, 0);
    */

    rfid_sensor.stop();
}
